t=int(input())
temp=[]
for i in range(t):
    b=int(input())
    n=[]
    for i in range(b):
        n.append(int(input()))
    temp.append(n)
for i in temp:
    i.sort()
    print(sum(i[1:]))    